from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from rest_framework.response import Response
from rest_framework import status

from system.models import Roles
from system.serializers.role import RoleSerializers

# Create your views here.
class RoleModelViewSet(ModelViewSet):
    """角色表视图集"""
    queryset = Roles.objects.all()
    serializer_class = RoleSerializers

    def list(self, request, *args, **kwargs):
        tree_dict = {}
        tree_data = []
        serializer = self.get_serializer(self.queryset, many=True)
        print(serializer.data)

        return Response(serializer.data, status=status.HTTP_200_OK)

class RoleListAPIView(ListAPIView):
    """定义Element Tree树结构"""
